package pl.wroc.uni.ii.gdomo;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;

public class MenuAcitvity  extends Activity {
	
	@Override
	public void onCreate(Bundle icicle) {
		super.onCreate(icicle);

		setContentView(R.layout.menu);

		final Spinner hardshipSpinner = (Spinner) findViewById(R.id.hardshipSpinner);
		ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.hardships, android.R.layout.simple_spinner_item);
		adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		hardshipSpinner.setAdapter(adapter);

		final Button startButton = (Button) findViewById(R.id.startButton);
		startButton.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				Intent intent = new Intent(MenuAcitvity.this, PuzzleActivity.class);
				String hardship = (String) hardshipSpinner
					.getItemAtPosition(hardshipSpinner.getSelectedItemPosition());
				intent.putExtra("hardship", hardship);
				MenuAcitvity.this.startActivity(intent);
			}
		});
		
		
		final Button optionsButton = (Button) findViewById(R.id.optionsButton);
		optionsButton.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				// e.g. grab and save music on or of etc
			}
		});

		final Button highScoresButton = (Button) findViewById(R.id.highScoresButton);
		highScoresButton.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				Intent intent = new Intent(MenuAcitvity.this, HighScoresActivity.class);
				MenuAcitvity.this.startActivity(intent);
			}
		});

		final Button quitButton = (Button) findViewById(R.id.quitButton);
		quitButton.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				finish();
			}
		});
	}
}
